@file:Suppress("unused", "CanBeParameter")

package cn.qfys521.mc_websocket.client

import kotlinx.serialization.json.JsonElement

sealed class ManagementException(message: String? = null, cause: Throwable? = null) : RuntimeException(message, cause) {
    class Timeout(message: String, cause: Throwable? = null) : ManagementException(message, cause)
    class ConnectionClosed(val code: Int?, val reason: String?, val remote: Boolean?) :
        ManagementException("Connection closed: code=$code reason=$reason remote=$remote")

    class Rpc(val code: Int?, message: String, val data: JsonElement?) : ManagementException("RPC $code: $message")
    class ParseError(message: String, cause: Throwable? = null) : ManagementException(message, cause)
    class Transport(cause: Throwable) : ManagementException("Transport error: ${cause.message}", cause)
}

